package com.sergiandreplace.walkshop.server.domain;

import java.io.Serializable;
import java.util.Date;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.sergiandreplace.walkshop.server.util.TextUtil;

@JsonInclude(value=Include.NON_EMPTY)
public class Walkeet implements Serializable {
	/**
	 * 
	 */
	private static final long serialVersionUID = 6192318120884960448L;
	private int id;
	private String title;
	private String body;
	private String tags;
	private float latitude;
	private float longitude;
	private Date timestamp;
	private float temperature;
	private float humidity;
	private float pressure;
	private float light;
	private String token;
	private String source;
	private String image;
	
	public Walkeet() {}
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	public String getTitle() {
		return title;
	}
	public void setTitle(String title) {
		this.title = title;
	}
	public String getBody() {
		return body;
	}
	public void setBody(String body) {
		this.body = body;
	}
	public String getTags() {
		return tags;
	}
	public void setTags(String tags) {
		this.tags = tags;
	}
	public float getLatitude() {
		return latitude;
	}
	public void setLatitude(float latitude) {
		this.latitude = latitude;
	}
	public float getLongitude() {
		return longitude;
	}
	public void setLongitude(float longitude) {
		this.longitude = longitude;
	}
	public Date getTimestamp() {
		return timestamp;
	}
	public void setTimestamp(Date timestamp) {
		this.timestamp = timestamp;
	}
	public float getTemperature() {
		return temperature;
	}
	public void setTemperature(float temperature) {
		this.temperature = temperature;
	}
	public float getHumidity() {
		return humidity;
	}
	public void setHumidity(float humidity) {
		this.humidity = humidity;
	}
	public float getPressure() {
		return pressure;
	}
	public void setPressure(float pressure) {
		this.pressure = pressure;
	}
	public float getLight() {
		return light;
	}
	public void setLight(float light) {
		this.light = light;
	}
	public String getToken() {
		return token;
	}
	public void setToken(String token) {
		this.token = token;
	}
	public String getSource() {
		return source;
	}
	public void setSource(String source) {
		this.source = source;
	}
	public String getImage() {
		return image;
	}
	public void setImage(String image) {
		this.image = image;
	}

	public boolean isOk() {
		if (TextUtil.isAnyEmpty(title,body,tags))
		{
			return false;
		}
		if (TextUtil.isLonger(title, 1024) ||
			TextUtil.isLonger(body, 8192) ||
			TextUtil.isLonger(tags, 1024) ||
			TextUtil.isLonger(token, 128) ||
			TextUtil.isLonger(source, 128) ||
			TextUtil.isLonger(image, 128)) {
			return false;
		}
		
		return true;
	}
	
}
